import java.util.ArrayList;

import model.Coordenada;


public  class TesteDistancia {
	
	public static void calc(){
Coordenada dest = new Coordenada(-23.517074,-46.533279);
		
		ArrayList<Coordenada>  stopsDestino = new ArrayList<Coordenada>();
		
		Double dist1 = dest.calculaDistancia(-23.552059, -46.63441);
		Double dist2 = dest.calculaDistancia(-23.552429, -46.633532);
		Double dist3 = dest.calculaDistancia(-23.555143, -46.63316);
		Double dist4 = dest.calculaDistancia(-23.557722, -46.633042);
		System.out.println("dist1: "+dist1);
		System.out.println("dist2: "+dist2);
		System.out.println("dist3: "+dist3);
		System.out.println("dist4: "+dist4);
		
		
		
		Coordenada c1 = new Coordenada(-23.552059, -46.63441);
		Coordenada c2 = new Coordenada(-23.552429, -46.633532);
		Coordenada c3 = new Coordenada(-23.555143, -46.63316);
		Coordenada c4 = new Coordenada(-23.557722, -46.633042);
		
		stopsDestino.add(c1);
		stopsDestino.add(c2);
		stopsDestino.add(c3);
		stopsDestino.add(c4);
		
		Coordenada destino = new Coordenada();
		destino = stopsDestino.get(0);
		double distStopDestino  = 0;
		double distStopDestinoTeste = 0;
		for(int i = 1; i < stopsDestino.size(); i++){
			distStopDestino = dest.calculaDistancia(destino.getLat(), destino.getLon());
			distStopDestinoTeste = dest.calculaDistancia(stopsDestino.get(i).getLat(), stopsDestino.get(i).getLon());
			if(distStopDestinoTeste <= distStopDestino){
				destino = stopsDestino.get(i);
			}
		}
		System.out.println("Menor Distância: "+dest.calculaDistancia(destino.getLat(), destino.getLon()));
//		Coordenada origem = new Coordenada();
//		Coordenada destino = new Coordenada();
//		
//		BuscaRota teste = new BuscaRota(origem, destino);
//		teste.buscar(origem, destino);
		
		//stopOrigem = dao.getStopOfTripStopId(trips.get(0), stops.get(0).getStop_id());
	}

}
